/*
 * @Author: jianglijun1004 
 * @Date: 2020-03-10 03:47:53 
 * @Last Modified by: jianglijun
 * @Last Modified time: 2020-03-10 03:48:19
 */
const template = require('art-template');
const heredoc = require('heredoc')
const tpl = heredoc(() => {
  /*
    <xml>
      <ToUserName><![CDATA[{{ToUserName}}]]></ToUserName>
      <FromUserName><![CDATA[{{FromUserName}}]]></FromUserName>
      <CreateTime>{{CreateTime}}</CreateTime> 
      <MsgType><![CDATA[{{MsgType}}]]></MsgType>
      {{if (MsgType==='text')}}<Content><![CDATA[{{@ Content}}]]></Content>
      {{else if (MsgType === 'image')}}
      <Image>
      <MediaId><![CDATA[{{Content.media_id}}]]></MediaId>
      </Image>
      {{else if (MsgType=== 'voice')}}
      <Voice>
        <MediaId><![CDATA[{{Content.media_id}}]]></MediaId>
      </Voice>
      {{else if(MsgType==='video')}}
      <Video>
        <MediaId><![CDATA[{{Content.media_id}}]]></MediaId>
        <Title><![CDATA[{{Content.title}}]]></Title>
        <Description><![CDATA[{{Content.description}}]]></Description>
      </Video>
      {{else if(MsgType==='music')}}
      <Music>
        <Title><![CDATA[{{Content.title}}]]></Title>
        <Description><![CDATA[{{Content.description}}]]></Description>
        <MusicUrl><![CDATA[{{Content.musicUrl}}]]></MusicUrl>
        <HQMusicUrl><![CDATA[{{Content.HQMusicUrl}}]]></HQMusicUrl>
        <ThumbMediaId><![CDATA[{{Content.ThumbMediaId}}]]></ThumbMediaId>
      </Music>
      {{else if(MsgType==='news')}}
      <ArticleCount><![CDATA[{{Content.length}}]]></ArticleCount>
      <Articles>
      {{each Content}}
        <item>
          <Title><![CDATA[{{$value.title}}]]></Title>
          <Description><![CDATA[{{$value.description}}]]></Description>
          <PicUrl><![CDATA[{{$value.picUrl}}]]></PicUrl>
          <Url><![CDATA[{{$value.url}}]]></Url>
        </item>
      {{/each}}
      </Articles>
      {{/if}}
    </xml>
  */
})
const compiled = template.compile(tpl);
exports = module.exports = {
  compiled
};
